1. Field of the Invention.
The present invention relates to bus mastering network controllers. More particularly, it relates to a simplified interface between a host and a network controller that allows the optimization of transmission of data from the lower protocol layer in the host across the system bus to the buffer memory in the controller which reduces CPU utilization and increases data transfer rates.
2. Description of the Prior Art.
A computer network is a system of hardware and software that allows two or more computers to communicate with each other. Networks are of several different kinds of which the most important are: local area networks ("LAN") campus networks, metropolitan area networks, ("MAN") wide area networks ("WAN") and enterprize networks.
FIG. 1 is a block diagram of the general setting of the invention. Referring now to FIG. 1, a CPU 10, a main memory 12 and a bus mastering network controller 14 are connected to system bus 16.
Bus mastering network controller 14 is a class of network controllers that is capable of transferring data from main memory directly without requiring any interaction by the host CPU. In order to do this, bus mastering controller 14 gains control of system bus 16 and reads or writes data directly to and from main memory 12. Bus mastering network controller 14 consists of a parallel side 18, a buffer memory 20 and a serial side 22. Parallel side 18 is connected to system bus 16 and serial side 22 is connected to network physical link 24. Bus mastering network controller 14 is specific to a particular type of network such as Ethernet, token ring, etc and provides the attachment point for the network physical link such as coaxial cable, fiber optic cable, wireless (where an antenna and base station are needed), etc. If the physical link is linear, such as Ethernet, a carrier sense multiple access/collision detection (CSMA/CD) system is used in which a node sends a signal that every other node detects but only the addressed node interprets as useful data. If two nodes send signals at the same time, a collision occurs and both backoff, wait for a unique random amount of time and then try again. A bus mastering network controller is described in more detail in the co-pending application referenced in the first section hereof.
Network communications are made possible by the addition of a network controller and physical link to a computer and by a network operating system ("NOS") located in each computer on the network. A NOS has an architecture which is typically layered. A layered architecture specifies different functions at different levels in a hierarchy of software and hardware functions. A typical layered architecture can be conceptualized as having five layers: an application layer at the top of the hierarchy followed by an upper protocol layer, a lower protocol layer, a driver layer and finally a physical layer which consists of a controller and the physical link. When the networking protocol stack is initialized, all layers bind to each other. That is, communication is established between layers by specifying buffer addresses and function entry points. As illustrated in FIG. 1, the physical layer consists of controller 16 and physical link 24. For each computer on the network, all of the layers of the protocol stack except the physical layer reside in the CPU and main memory. The controller is connected to the CPU and main memory over the system bus.
FIG. 2 is a block diagram of a typical NOS protocol stack and emphasizes the structures and relationships created in the lower protocol layer and the driver layer. The physical layer consisting of controller 14 and network physical link 24 of FIG. 1 are not shown. The lower protocol layer data structures and their names are those of the NETWARE network operating systems. NETWARE is a trade name of Novell, Inc.
Referring now to FIG. 2, a protocol stack 30 has a top layer 32 typically called an application layer. The application layer is the user interface layer of protocol stack 30. It is the layer in which the data to be transmitted is created. For example, the user interface layer may be a word processor and the data to be sent is a file that was created by the user with the word processor.
Immediately below application layer 32 is upper protocol layer 34. Upper protocol layer 34 does error checking, handshaking and in some cases compression. Upper protocol layer 34 also specifies the destination of the data to be transmitted and passes the data to be transmitted to lower protocol layer 36 in predetermined quantities called packets. This is because lower protocol layer 36 cannot handle an unlimited amount of data at any given time.
Immediately below upper protocol layer 34 is lower protocol layer 36. Lower protocol layer 36 includes the communications services which are a set of conventions which define how communication over a network will be structured. In general, data passed from upper protocol layer 34 as packets are broken down further by lower protocol layer 36 into frames. A frame is a data structure for transmitting data over a serial communication channel and typically includes a flag that indicates the start of the frame followed by an address, a control field, a data field and a frame check sequence field for error correction. The data field may be either fixed or variable. In the case of Ethernet, the frame is of variable size with a maximum size of 1,514 bytes. In performing these functions, lower protocol layer 36 establishes a set of descriptor, buffer and control fields in a dedicated portion of main memory called lower protocol space which is illustrated schematically in FIG. 2 as the space in which the various data structures reside. Within lower protocol space there are two types of data structures. They are transmit control blocks ("TCB") with their associated fragment structures and transmit data buffers. TCBs and TCB fragment structures are used to transfer data from the lower protocol layer via a driver layer (to be described later) to the controller. When sending a frame of data, the upper protocol layer assembles a list of fragment pointers and passes them to the lower protocol layer where a TCB and TCB fragment structure are constructed. The TCB consists of header type information. The TCB fragment structure consists of pointers to actual data in main memory to be transmitted. In FIG. 2, the TCB is indicated by reference numeral 38 and the TCB fragment structure is indicated by reference numeral 40. A field in TCB 38 points to the address of fragment structure 40 as illustrated by arrow 48. Fragment structure 40 consists of a first field 50 consisting of four bytes and containing the count of the number of data fragment descriptors 52, 54 and 56 (in this case 3 for example) contained in fragment structure 40. Each fragment descriptor contains a pointer field and a size field. Each pointer field contains the address of the first byte of a transmit data buffer. For example, the pointer field in fragment descriptor 52 contains the address of the first byte in transmit data buffer 42. This is illustrated in FIG. 2 by arrow 53. The size field in fragment descriptor 52 contains the size in bytes of transmit data buffer 42. In like fashion, the pointer field in fragment descriptor 54 contains the address of the first byte in transmit data buffer 44 which is illustrated in FIG. 2 by arrow 55, and the size field in fragment descriptor 54 contains the size in bytes of transmit data buffer 44. The same holds true for fragment descriptor 56 and transmit data buffer 46. Fragment structure 40 may have any number of fragment descriptors. All fields in fragment structure 40 are contiguous in lower protocol space.
The transmit data buffer, in this case buffers 42, 44 and 46, are a set of contiguous memory locations in main memory that contain the actual user data to be transmitted over physical link 24 in FIG. 1. Transmit data buffers may be of any length and there may be any number. However, the data contained in all transmit data buffers referenced by all fragment descriptors contained in fragment structure 40 can be no larger than a frame of data. If the data to be transmitted is greater than one frame, multiple frames are sent. To do this, the lower protocol layer sets up multiple TCBs which are linked. One TCB and its associated TCB fragment structure are set up for each frame of data to be transmitted.
Immediately below lower protocol layer 36 is driver layer 60. Driver layer 60 is a software module that is specific to network controller 14 hardware. The purpose of a software driver in general is to isolate the hardware specific software functions in one module. This facilitates interchangeibility of hardware and software components designed by different organizations. Specifically driver layer 60 programs network controller 14 to carry out specific functions and transfers data between network controller 14 and lower protocol layer 36. To carry out these functions, a driver layer is divided typically into two functional parts: a memory management module that sets up and manages certain data structures in a dedicated portion of main memory 12 called driver space, and a transmit module which takes transmit requests from lower protocol layer 36 and programs network controller 14 hardware to carry out the actual transmission of a frame over network physical link 24. When driver layer 60 initializes, it allocates a portion of main memory 12 from the NOS and partitions this memory into data structures called transmit command blocks ("TxCB") and an associated chain of transmit data buffer descriptors ("TBD"). There are a predetermined number of each that are set up. In FIG. 2, a TxCB is indicated by reference numeral 62 and three TBDs are indicated by reference numerals 64,66 and 68.
When a TCB is handed off from lower protocol layer 36 to driver layer 60, driver layer sets up a TBD for each transmit data buffer. A specified field in TxCB 62 points toward the first byte in a TBD, in this case TBD 64. This is illustrated by arrow 70. Each TBD includes, among other fields, a next TBD address field and a transmit data buffer address field. This field is required since the TBD address field is the address of another TBD. The TBDs are not in a contiguous array in driver space. Accordingly, if more than one TBD is used for a frame, a pointer to the location of the next TBD is required. The group of TBDs needed to transfer and entire frame is known as a chain of TBDs.
The transmit data buffer address field is the address of the first byte of a transmit data buffer in main memory. For example, the transmit data buffer address field in TBD 64 points to transmit data buffer 46 as illustrated by arrow 65 and the transmit data buffer address field in TBD 66 points to transmit data buffer 44 as illustrated by arrow 67. In like fashion, the transmit data buffer field in TBD 68 points to transmit data buffer field 46 as illustrated by arrow 69.
FIG. 3 is a block diagram of the structure of TCB 38. Referring now to FIG. 3, TCB 38 consists of TCB driver work space field 80 which is 12 bytes in length and may be used for any purpose by driver layer 60 to control TCBs. The next field is TCB data length field 82. This field contains the length of data in the optional data portion of the TCB. The next field 84 is the TCB fragment structure pointer. This field contains a pointer to the first byte of fragment structure 40. The remainder of TCB 38 consists of the length of optional data 86 and the optional data field 88. Optional data field 88 immediately follows the TCB in memory. Length field 86 specifies the length of this field which may be zero.
FIG. 4 is a block diagram of the structure of TCB fragment structure 40. Referring now to FIG. 4, TCB fragment structure 40 consists of a number of fragments field 90 followed by any number of data fragment descriptors 92a through 92n. Each data fragment descriptor consists of two fields: a pointer field 94 that contains the address of the first byte of the first transmit data buffer and a length field 96 that specifies the length of the transmit data buffer to which pointer field 94 points. In the case of NETWARE, until recently, pointer field 94 contained a virtual address. Recently however, NETWARE has made it possible to specify that either a virtual or a physical address be loaded into pointer field 94 at initialization by setting a flag at that time. Number of fragments field 90 contains the number of data fragment descriptors that follow in the TCB fragment structure.
FIG. 5 is a block diagram of the structure of TxCB 62. Referring now to FIG. 5, field 100 consists of 16 bits that are various control bits used to issue transmit commands to network controller 14. Field 102 is a field of 16 bits that contains data on the status of the transmission of the frame associated with this TxCB over physical link 24. Field 106 is a link address to the next TxCB if the data to be transmitted exceeds one frame. If only one frame is required or this is the last frame to be sent, this field is set up as all ones. Field 108 is the TBD address. That is, this field points to the first byte in the first TBD. Field 110 is required to be all zeros. Field 112, called the end of frame ("EOF") field, is a one bit field that indicates if the entire frame is in the optional data portion of the TxCB. Field 114 gives the number of bytes in optional data field 116. Field 116 is the optional data field corresponding to field 86 in TCB 38 of FIG. 3.
FIG. 6 is a block diagram of the structure of TBD 72. Referring now to FIG. 6, field 120 consisting of 16 bits is not used and is all zeros. Field 122 is a one bit EOF field. This is set to 1 if this TBD is the last in a chain of TBDs needed to send an entire frame. Field 126 specifies the size of the transmit data buffer for which this TBD is a descriptor. Field 128 contains the address of the first byte of the next TBD in the chain of TBDs required for this frame. If there are no more TBDs required to send the fame, this field is all zeros and the EOF bit is 1. Field 130 contains the address of the first byte of the transmit data buffer for which this TBD is a descriptor. This address must be a physical address. Thus, if pointer field 94 contained a virtual address, it must be translated into a physical address before being sent to controller 14.
Immediately below the driver layer in the protocol stack is the physical layer. The physical layer is the hardware which includes network controller 14 and physical link 24.
When a bus mastering network controller is used, a data frame is communicated from CPU 10 to bus mastering network controller 14 by having driver layer 60 set up transmit data buffers and descriptors in main memory 12 that contain all of the information about the frame to be transmitted such as frame length, frame header and pointers to application data fragments. The bus mastering network controller is then able to transfer the data directly from application fragments 42, 44 and 46 in FIG. 2 directly to buffer memory 20 of controller 14 in FIG. 1 without requiring any data copy from CPU 10.
FIG. 7 is a flow chart of the method according to the prior art. Referring now to FIG. 7, at process step 140, when driver layer 60 initializes, it allocates a portion of memory from the NOS and partitions this memory into a pool of TxCB's and a pool of TBD's. There are a predetermined and limited number of each in their respective pools.
Subsequently, at process step 142, when a frame is to be transmitted, the driver layer transmit module requests a TxCB from the memory management module of driver layer 60 that is not being used in connection with the transmission of a previous frame. If a free TxCB is available, it is allocated for use with the current frame. In addition, the memory management module of driver layer 60 allocates the appropriate number of TBD's which is determined by the number of fragment structure pointers in the TCB. The appropriate number of TBDs may not be immediately available if too many of the limited number of TBDs in the pool are being used for different frames. At process step 144, after the appropriate number of TBDs have been allocated, the driver layer transmit module then sets up the individual fields in TxCB 62. At process step 146, the transmit module copies any optional data that might be present in the TCB optional data field into the optional data field in the TxCB. At process step 148, the transmit module of the driver sets up the individual TBD's that will be associated with that frame. This process step includes setting up the size field 126, the EOF bit on the last TBD in the chain. At process step 150, the transmit module fetches the individual address of each fragment from the TCB fragment structure and causes the virtual address to be translated into a physical address by requesting a translation from the NOS. The new address is then copied into the TBD. This is done for every TBD associated with that TxCB.
At process step 152, the transmit module of the driver layer sets up the last TBD in the chain. This includes setting the next TBD address to all zeros and setting the EOF field to one. At process step 154, after the last TBD has been initialized, the transmit module of the driver layer sets up a pointer from the TxCB to the first TBD in the chain. At this point, the setup of the frame is complete and the driver then issues a transmit command ("Tx") to the network controller as indicated by process step 156. Upon receipt of the Tx command, controller 14 copies the fields of the TxCB to itself. In this way controller 14 is programmed.
The problems with the old structure and the process are as follows: First, the chain of TBDs are not a contiguous array of memory locations in main memory. Thus, a complete memory cycle must be initiated to access each separate TBD. And the initiation of a new memory cycle is a limit on burst mode transfer of data from main memory. A burst is a continuous transfer of data without interruption from main memory to a controller. In a multiplexing bus, burst mode provides an efficient way to dedicate the bus for the transmission of data from one source. Also, a move from one TBD to the next, is interpreted by the bus access controller to be a break point at which time other resources on the system bus may access the bus. That is, if there is contention for the bus, a bus master device must give up the bus which is also a reduction of the data transfer rate.
The second problem is that TBDs require memory management. The driver layer must have a memory management module that sets up TBDs for each frame to be transferred and reallocates them after a frame has been transferred.
The third problem is an increased risk of underruns. This is because of the break between transmission of discreet TBDs. During the break, a bus mastered controller may lose access to the system bus after the threshold has been reached.